home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 2: CDPD 1 / Almathera Ten on Ten - Disc 2: CDPD 1.iso / pd / 026-050 / 049 / cycloids / hypocycloid3.c < prev    next >
C/C++ Source or Header  |  1995-03-13  |  26KB  |  849 lines

  1. /* hypocycloid3.c */
  2. /* based on the articles on cycloids in Creative Computing May-June 1984
  3. and the article in February 1984 BYTE "Five Original Graphics" */
  4.  
  5. void IMsg();
  6. int stopcheck();
  7.  
  8. /* Include the definitions  and functions we need */
  9.  
  10. #include "hypocycloid2.h"
  11. #include "hypo2.c"
  12. #include "palette.c"
  13. #include "save.c"
  14. #include "newradii.c"
  15.  
  16. struct IntuiText Menu0IText [] = {
  17.  
  18.    {
  19.    0,3,JAM2,      /* Front Pen, Back Pen, Draw Mode */
  20.    0,0,            /* Left Edge, Top Edge */
  21.    &TestFont,         /* pointer to Text Font */
  22.    " new ",   /* text of Menu Item */
  23.    NULL            /* pointer to next IText */
  24.    },
  25.  
  26.    {0,3,JAM2,0,0,&TestFont," go  ",NULL },
  27.    {0,3,JAM2,0,0,&TestFont,"stop ",NULL },
  28.    {0,3,JAM2,0,0,&TestFont,"cycle",NULL },
  29.    {0,3,JAM2,0,0,&TestFont,"color",NULL },
  30.    {0,3,JAM2,0,0,&TestFont,"save ",NULL },
  31.    {0,3,JAM2,0,0,&TestFont,"clear",NULL },
  32.    {0,3,JAM2,0,0,&TestFont,"quit ",NULL },
  33. };
  34.  
  35. struct MenuItem Menu0Item[8] = {
  36.    {
  37.    &Menu0Item[1],         /* pointer to next Item */
  38.    0,0,50,9,      /* Left, Top, Width, Height */
  39.    ITEMTEXT | ITEMENABLED | HIGHCOMP,   /* Flags */
  40.    0,            /*  no mutual exclude */
  41.    (APTR)&Menu0IText[0],   /* Render info */   
  42.    NULL,NULL,NULL,         /*Alt Image, Command (amiga) char, subitem*/
  43.    MENUNULL      /* next select */
  44.    },
  45.  
  46.    {&Menu0Item[2],0,9,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  47.    0,(APTR)&Menu0IText[1],NULL,NULL,NULL,MENUNULL},
  48.  
  49.    {&Menu0Item[3],0,18,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  50.    0,(APTR)&Menu0IText[2],NULL,NULL,NULL,MENUNULL},
  51.  
  52.    {&Menu0Item[4],0,27,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  53.    0,(APTR)&Menu0IText[3],NULL,NULL,NULL,MENUNULL},
  54.  
  55.    {&Menu0Item[5],0,36,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  56.    0,(APTR)&Menu0IText[4],NULL,NULL,NULL,MENUNULL},
  57.  
  58.    {&Menu0Item[6],0,45,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  59.    0,(APTR)&Menu0IText[5],NULL,NULL,NULL,MENUNULL},
  60.  
  61.    {&Menu0Item[7],0,54,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  62.    0,(APTR)&Menu0IText[6],NULL,NULL,NULL,MENUNULL},
  63.  
  64.    {NULL,0,63,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP,
  65.    0,(APTR)&Menu0IText[7],NULL,NULL,NULL,MENUNULL}
  66. };
  67.  
  68. struct IntuiText Menu1IText [] = {
  69.  
  70.    {
  71.    0,3,JAM2,      /* Front Pen, Back Pen, Draw Mode */
  72.    0,0,            /* Left Edge, Top Edge */
  73.    &TestFont,         /* pointer to Text Font */
  74.    " 0.00",   /* text of Menu Item */
  75.    NULL            /* pointer to next IText */
  76.    },
  77.  
  78.    {0,3,JAM2,0,0,&TestFont," 0.25",NULL },
  79.    {0,3,JAM2,0,0,&TestFont," 0.50",NULL },
  80.    {0,3,JAM2,0,0,&TestFont," 0.75",NULL },
  81.    {0,3,JAM2,0,0,&TestFont," 1.00",NULL },
  82.    {0,3,JAM2,0,0,&TestFont," 1.25",NULL },
  83.    {0,3,JAM2,0,0,&TestFont," 1.50",NULL },
  84.    {0,3,JAM2,0,0,&TestFont," 1.75",NULL },
  85.    {0,3,JAM2,0,0,&TestFont," 2.00",NULL },
  86.    {0,3,JAM2,0,0,&TestFont," 2.50",NULL },
  87. };
  88.  
  89. struct MenuItem Menu1Item[10] = {
  90.    {
  91.    &Menu1Item[1],         /* pointer to next Item */
  92.    0,0,50,9,      /* Left, Top, Width, Height */
  93.    ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,   /* Flags */
  94.    (~(1 << 0)),            /* mutual exclude */
  95.    (APTR)&Menu1IText[0],   /* Render info */
  96.    NULL,NULL,NULL,         /*Alt Image, Command (amiga) char, subitem*/
  97.    MENUNULL      /* next select */
  98.    },
  99.  
  100.    {&Menu1Item[2],0,9,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  101.    (~(1 << 1)),(APTR)&Menu1IText[1],NULL,NULL,NULL,MENUNULL},
  102.  
  103.    {&Menu1Item[3],0,18,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  104.    (~(1 << 2)),(APTR)&Menu1IText[2],NULL,NULL,NULL,MENUNULL},
  105.  
  106.    {&Menu1Item[4],0,27,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  107.    (~(1 << 3)),(APTR)&Menu1IText[3],NULL,NULL,NULL,MENUNULL},
  108.  
  109.    {&Menu1Item[5],0,36,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT | CHECKED,
  110.    (~(1 << 4)),(APTR)&Menu1IText[4],NULL,NULL,NULL,MENUNULL},
  111.  
  112.    {&Menu1Item[6],0,45,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  113.    (~(1 << 5)),(APTR)&Menu1IText[5],NULL,NULL,NULL,MENUNULL},
  114.  
  115.    {&Menu1Item[7],0,54,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  116.    (~(1 << 6)),(APTR)&Menu1IText[6],NULL,NULL,NULL,MENUNULL},
  117.  
  118.    {&Menu1Item[8],0,63,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  119.    (~(1 << 7)),(APTR)&Menu1IText[7],NULL,NULL,NULL,MENUNULL},
  120.  
  121.    {&Menu1Item[9],0,72,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  122.    (~(1 << 8)),(APTR)&Menu1IText[8],NULL,NULL,NULL,MENUNULL},
  123.  
  124.    {NULL,0,81,50,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  125.    (~(1 << 9)),(APTR)&Menu1IText[9],NULL,NULL,NULL,MENUNULL}
  126. };
  127.  
  128. struct IntuiText Menu2IText [] = {
  129.  
  130.    {
  131.    0,3,JAM2,      /* Front Pen, Back Pen, Draw Mode */
  132.    0,0,            /* Left Edge, Top Edge */
  133.    &TestFont,         /* pointer to Text Font */
  134.    "  0%",   /* text of Menu Item */
  135.    NULL            /* pointer to next IText */
  136.    },
  137.  
  138.    {0,3,JAM2,0,0,&TestFont," 10%",NULL },
  139.    {0,3,JAM2,0,0,&TestFont," 20%",NULL },
  140.    {0,3,JAM2,0,0,&TestFont," 30%",NULL },
  141. };
  142.  
  143. struct MenuItem Menu2Item[4] = {
  144.    {
  145.    &Menu2Item[1],         /* pointer to next Item */
  146.    0,0,40,9,      /* Left, Top, Width, Height */
  147.    ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,   /* Flags */
  148.    (~(1 << 0)),            /* mutual exclude */
  149.    (APTR)&Menu2IText[0],   /* Render info */
  150.    NULL,NULL,NULL,         /*Alt Image, Command (amiga) char, subitem*/
  151.    MENUNULL      /* next select */
  152.    },
  153.  
  154.    {&Menu2Item[2],0,9,40,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT | CHECKED,
  155.    (~(1 << 1)),(APTR)&Menu2IText[1],NULL,NULL,NULL,MENUNULL},
  156.  
  157.    {&Menu2Item[3],0,18,40,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  158.    (~(1 << 2)),(APTR)&Menu2IText[2],NULL,NULL,NULL,MENUNULL},
  159.  
  160.    {NULL,0,27,40,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  161.    (~(1 << 3)),(APTR)&Menu2IText[3],NULL,NULL,NULL,MENUNULL}
  162. };
  163.  
  164. struct IntuiText Menu3IText [] = {
  165.    {
  166.    0,3,JAM2,      /* Front Pen, Back Pen, Draw Mode */
  167.    0,0,            /* Left Edge, Top Edge */
  168.    &TestFont,         /* pointer to Text Font */
  169.    " 10%",   /* text of Menu Item */
  170.    NULL            /* pointer to next IText */
  171.    },
  172.  
  173.    {0,3,JAM2,0,0,&TestFont," 20%",NULL },
  174.    {0,3,JAM2,0,0,&TestFont," 30%",NULL },
  175.    {0,3,JAM2,0,0,&TestFont," 40%",NULL },
  176.    {0,3,JAM2,0,0,&TestFont," 50%",NULL },
  177.    {0,3,JAM2,0,0,&TestFont," 60%",NULL },
  178.    {0,3,JAM2,0,0,&TestFont," 70%",NULL },
  179.    {0,3,JAM2,0,0,&TestFont," 80%",NULL },
  180. };
  181.  
  182. struct MenuItem Menu3Item[8] = {
  183.    {
  184.    &Menu3Item[1],         /* pointer to next Item */
  185.    0,0,40,9,      /* Left, Top, Width, Height */
  186.    ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,   /* Flags */
  187.    (~(1 << 0)),            /* mutual exclude */
  188.    (APTR)&Menu3IText[0],   /* Render info */
  189.    NULL,NULL,NULL,         /*Alt Image, Command (amiga) char, subitem*/
  190.    MENUNULL      /* next select */
  191.    },
  192.  
  193.    {&Menu3Item[2],0,9,40,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  194.    (~(1 << 1)),(APTR)&Menu3IText[1],NULL,NULL,NULL,MENUNULL},
  195.  
  196.    {&Menu3Item[3],0,18,40,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  197.    (~(1 << 2)),(APTR)&Menu3IText[2],NULL,NULL,NULL,MENUNULL},
  198.  
  199.    {&Menu3Item[4],0,27,40,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  200.    (~(1 << 3)),(APTR)&Menu3IText[3],NULL,NULL,NULL,MENUNULL},
  201.  
  202.    {&Menu3Item[5],0,36,40,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT | CHECKED,
  203.    (~(1 << 4)),(APTR)&Menu3IText[4],NULL,NULL,NULL,MENUNULL},
  204.  
  205.    {&Menu3Item[6],0,45,40,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  206.    (~(1 << 5)),(APTR)&Menu3IText[5],NULL,NULL,NULL,MENUNULL},
  207.  
  208.    {&Menu3Item[7],0,54,40,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  209.    (~(1 << 6)),(APTR)&Menu3IText[6],NULL,NULL,NULL,MENUNULL},
  210.  
  211.    {NULL,0,63,40,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  212.    (~(1 << 7)),(APTR)&Menu3IText[7],NULL,NULL,NULL,MENUNULL}
  213. };
  214.  
  215. struct IntuiText Menu4IText [] = {
  216.  
  217.    {
  218.    0,3,JAM2,      /* Front Pen, Back Pen, Draw Mode */
  219.    0,0,            /* Left Edge, Top Edge */
  220.    &TestFont,         /* pointer to Text Font */
  221.    "  0",   /* text of Menu Item */
  222.    NULL            /* pointer to next IText */
  223.    },
  224.  
  225.    {0,3,JAM2,0,0,&TestFont,"  3",NULL },
  226.    {0,3,JAM2,0,0,&TestFont,"  6",NULL },
  227.    {0,3,JAM2,0,0,&TestFont,"  9",NULL },
  228.    {0,3,JAM2,0,0,&TestFont," 12",NULL },
  229.    {0,3,JAM2,0,0,&TestFont," 15",NULL },
  230.    {0,3,JAM2,0,0,&TestFont," 18",NULL },
  231.    {0,3,JAM2,0,0,&TestFont," 21",NULL },
  232.    {0,3,JAM2,0,0,&TestFont," 24",NULL },
  233.    {0,3,JAM2,0,0,&TestFont," 30",NULL },
  234. };
  235.  
  236. struct MenuItem Menu4Item[10] = {
  237.    {
  238.    &Menu4Item[1],         /* pointer to next Item */
  239.    0,0,30,9,      /* Left, Top, Width, Height */
  240.    ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,   /* Flags */
  241.    (~(1 << 0)),            /* mutual exclude */
  242.    (APTR)&Menu4IText[0],   /* Render info */
  243.    NULL,NULL,NULL,         /*Alt Image, Command (amiga) char, subitem*/
  244.    MENUNULL      /* next select */
  245.    },
  246.  
  247.    {&Menu4Item[2],0,9,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  248.    (~(1 << 1)),(APTR)&Menu4IText[1],NULL,NULL,NULL,MENUNULL},
  249.  
  250.    {&Menu4Item[3],0,18,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  251.    (~(1 << 2)),(APTR)&Menu4IText[2],NULL,NULL,NULL,MENUNULL},
  252.  
  253.    {&Menu4Item[4],0,27,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT | CHECKED,
  254.    (~(1 << 3)),(APTR)&Menu4IText[3],NULL,NULL,NULL,MENUNULL},
  255.  
  256.    {&Menu4Item[5],0,36,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  257.    (~(1 << 4)),(APTR)&Menu4IText[4],NULL,NULL,NULL,MENUNULL},
  258.  
  259.    {&Menu4Item[6],0,45,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  260.    (~(1 << 5)),(APTR)&Menu4IText[5],NULL,NULL,NULL,MENUNULL},
  261.  
  262.    {&Menu4Item[7],0,54,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  263.    (~(1 << 6)),(APTR)&Menu4IText[6],NULL,NULL,NULL,MENUNULL},
  264.  
  265.    {&Menu4Item[8],0,63,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  266.    (~(1 << 7)),(APTR)&Menu4IText[7],NULL,NULL,NULL,MENUNULL},
  267.  
  268.    {&Menu4Item[9],0,72,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  269.    (~(1 << 8)),(APTR)&Menu4IText[8],NULL,NULL,NULL,MENUNULL},
  270.  
  271.    {NULL,0,81,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  272.    (~(1 << 9)),(APTR)&Menu4IText[9],NULL,NULL,NULL,MENUNULL}
  273. };
  274.  
  275. struct IntuiText Menu5IText [] = {
  276.  
  277.    {
  278.    0,3,JAM2,      /* Front Pen, Back Pen, Draw Mode */
  279.    0,0,            /* Left Edge, Top Edge */
  280.    &TestFont,         /* pointer to Text Font */
  281.    "  1",   /* text of Menu Item */
  282.    NULL            /* pointer to next IText */
  283.    },
  284.  
  285.    {0,3,JAM2,0,0,&TestFont,"  2",NULL },
  286.    {0,3,JAM2,0,0,&TestFont,"  3",NULL },
  287.    {0,3,JAM2,0,0,&TestFont,"  4",NULL },
  288.    {0,3,JAM2,0,0,&TestFont,"  5",NULL },
  289.    {0,3,JAM2,0,0,&TestFont,"  6",NULL },
  290.    {0,3,JAM2,0,0,&TestFont,"  7",NULL },
  291.    {0,3,JAM2,0,0,&TestFont,"  8",NULL },
  292.    {0,3,JAM2,0,0,&TestFont,"  9",NULL },
  293.    {0,3,JAM2,0,0,&TestFont," 10",NULL },
  294. };
  295.  
  296. struct MenuItem Menu5Item[10] = {
  297.    {
  298.    &Menu5Item[1],         /* pointer to next Item */
  299.    0,0,30,9,      /* Left, Top, Width, Height */
  300.    ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,   /* Flags */
  301.    (~(1 << 0)),            /* mutual exclude */
  302.    (APTR)&Menu5IText[0],   /* Render info */
  303.    NULL,NULL,NULL,         /*Alt Image, Command (amiga) char, subitem*/
  304.    MENUNULL      /* next select */
  305.    },
  306.  
  307.    {&Menu5Item[2],0,9,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  308.    (~(1 << 1)),(APTR)&Menu5IText[1],NULL,NULL,NULL,MENUNULL},
  309.  
  310.    {&Menu5Item[3],0,18,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  311.    (~(1 << 2)),(APTR)&Menu5IText[2],NULL,NULL,NULL,MENUNULL},
  312.  
  313.    {&Menu5Item[4],0,27,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT | CHECKED,
  314.    (~(1 << 3)),(APTR)&Menu5IText[3],NULL,NULL,NULL,MENUNULL},
  315.  
  316.    {&Menu5Item[5],0,36,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  317.    (~(1 << 4)),(APTR)&Menu5IText[4],NULL,NULL,NULL,MENUNULL},
  318.  
  319.    {&Menu5Item[6],0,45,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  320.    (~(1 << 5)),(APTR)&Menu5IText[5],NULL,NULL,NULL,MENUNULL},
  321.  
  322.    {&Menu5Item[7],0,54,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  323.    (~(1 << 6)),(APTR)&Menu5IText[6],NULL,NULL,NULL,MENUNULL},
  324.  
  325.    {&Menu5Item[8],0,63,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  326.    (~(1 << 7)),(APTR)&Menu5IText[7],NULL,NULL,NULL,MENUNULL},
  327.  
  328.    {&Menu5Item[9],0,72,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  329.    (~(1 << 8)),(APTR)&Menu5IText[8],NULL,NULL,NULL,MENUNULL},
  330.  
  331.    {NULL,0,81,30,9,ITEMTEXT | ITEMENABLED | HIGHCOMP | CHECKIT,
  332.    (~(1 << 9)),(APTR)&Menu5IText[9],NULL,NULL,NULL,MENUNULL}
  333. };
  334. struct Menu BdMenu[6] = {
  335.    {
  336.    &BdMenu[1],      /* ptr to next Menu */
  337.    5,0,50,0,   /* left,top,width,height--top and height ignored */
  338.    MENUENABLED,   /* Flags */
  339.    "Main ",   /* menu title */
  340.    &Menu0Item[0]   /* First Item in list */
  341.    },
  342. {&BdMenu[2],65,0,50,0,MENUENABLED," > < ",&Menu1Item[0]},
  343. {&BdMenu[3],125,0,40,0,MENUENABLED,"-> <",&Menu2Item[0]},
  344. {&BdMenu[4],175,0,40,0,MENUENABLED,"> <-",&Menu3Item[0]},
  345. {&BdMenu[5],225,0,30,0,MENUENABLED,">>°",&Menu4Item[0]},
  346. {NULL,265,0,50,0,MENUENABLED,"#COLS",&Menu5Item[0]}
  347. };
  348. int an,bd,col,cycle,cc,delay,ex,rr;
  349. double bf,bl,cf,dd,l,z;
  350. extern int aa,bb;
  351. int sav;
  352. UWORD color18, color19;
  353.  
  354. main()
  355. {
  356.    USHORT drawing;
  357.  
  358.    drawing=1;
  359.    delay=9000;
  360.    cycle=0;
  361.    col=4;
  362.    ex=0;
  363.    cc=1.0;
  364.    an=9;
  365.    rr=1;
  366.    bd=1;
  367.    dd=360.0;
  368.    bf=.1;
  369.    cf=.5;
  370.    l=0;
  371.    bl=1.0;
  372.    z=1;
  373.    aa=5;
  374.    bb=2;
  375.    initwind();
  376.    init_colors();
  377.    init_scr();
  378.    fillscreen();
  379.    precalculate();
  380.    doepic();
  381.    while(drawing){
  382.       IMsg();
  383.    }
  384. }   /* end of main */
  385.  
  386. void IMsg()
  387.  
  388. {
  389.    struct IntuiMessage *BdMsg;      /* Intuition message structure */
  390.    ULONG Mclass;               /* Message class */
  391.    USHORT Mcode;            /* Message code */
  392.  
  393.    if (cycle==1)
  394.       cyclecolors();
  395.  
  396. while (BdMsg = (struct IntuiMessage *)GetMsg(w->UserPort))
  397.    {
  398.    Mclass = BdMsg->Class;
  399.    Mcode = BdMsg->Code;
  400.    ReplyMsg(BdMsg);
  401.    switch (Mclass) {
  402.       case CLOSEWINDOW:
  403.          clear_colors();
  404.          Cleanup();
  405.          exit(TRUE);
  406.          break;
  407.  
  408.       case MENUPICK:
  409.          switch (MENUNUM(Mcode)){
  410.             case 0:
  411.                switch (ITEMNUM(Mcode)){
  412.                   case 0:
  413.                      newradii(w);
  414.                      break;
  415.                   case 1:
  416.                      doepic();
  417.                      break;
  418.                   case 2:
  419.                      break;
  420.                   case 3:
  421.                      if (cycle==0)
  422.                         cycle=1;
  423.                      else
  424.                         cycle=0;
  425.                      break;
  426.                   case 4:
  427.                      palette(w);
  428.                      break;
  429.                   case 5:
  430.                      sav=save(w);
  431.                      if (sav == 1){
  432.                         color18=GetRGB4(p_Co,18);
  433.                         color19=GetRGB4(p_Co,19);
  434.                         SetRGB4(vp,18,15,0,0);   /* red */
  435.                         SetRGB4(vp,19,15,15,15); /* white */
  436.                         SetPointer(w,&PointImage,14,16,0,0);
  437.                         SavePicture();
  438.                         ClearPointer(w);
  439.                         *(p_ct+18)=(USHORT)color18;
  440.                         *(p_ct+19)=(USHORT)color19;
  441.                         LoadRGB4(vp,p_ct,CTSIZ);
  442.                      }
  443.                      break;
  444.                   case 6:
  445.                      fillscreen();
  446.                      break;
  447.                   case 7:
  448.                      clear_colors();
  449.                      Cleanup();
  450.                      exit(TRUE);
  451.                      break;
  452.                }
  453.                break;
  454.             case 1:
  455.                switch (ITEMNUM(Mcode)){
  456.                   case 0:
  457.                      cc=0;
  458.                      break;
  459.                   case 1:
  460.                      cc=.25;
  461.                      break;
  462.                   case 2:
  463.                      cc=.5;
  464.                      break;
  465.                   case 3:
  466.                      cc=.75;
  467.                      break;
  468.                   case 4:
  469.                      cc=1.0;
  470.                      break;
  471.                   case 5:
  472.                      cc=1.25;
  473.                      break;
  474.                   case 6:
  475.                      cc=1.5;
  476.                      break;
  477.                   case 7:
  478.                      cc=1.75;
  479.                      break;
  480.                   case 8:
  481.                      cc=2.0;
  482.                      break;
  483.                   case 9:
  484.                      cc=2.5;
  485.                      break;
  486.                }
  487.                break;
  488.             case 2:
  489.                switch (ITEMNUM(Mcode)){
  490.                   case 0:
  491.                      bf=0;
  492.                      break;
  493.                   case 1:
  494.                      bf=.1;
  495.                      break;
  496.                   case 2:
  497.                      bf=.2;
  498.                      break;
  499.                   case 3:
  500.                      bf=.3;
  501.                      break;
  502.                }
  503.                break;
  504.             case 3:
  505.                switch (ITEMNUM(Mcode)){
  506.                   case 0:
  507.                      cf=.1;
  508.                      break;
  509.                   case 1:
  510.                      cf=.2;
  511.                      break;
  512.                   case 2:
  513.                      cf=.3;
  514.                      break;
  515.                   case 3:
  516.                      cf=.4;
  517.                      break;
  518.                   case 4:
  519.                      cf=.5;
  520.                      break;
  521.                   case 5:
  522.                      cf=.6;
  523.                      break;
  524.                   case 6:
  525.                      cf=.7;
  526.                      break;
  527.                   case 7:
  528.                      cf=.8;
  529.                      break;
  530.                }
  531.                break;
  532.             case 4:
  533.                switch (ITEMNUM(Mcode)){
  534.                   case 0:
  535.                      an=0;
  536.                      break;
  537.                   case 1:
  538.                      an=3;
  539.                      break;
  540.                   case 2:
  541.                      an=6;
  542.                      break;
  543.                   case 3:
  544.                      an=9;
  545.                      break;
  546.                   case 4:
  547.                      an=12;
  548.                      break;
  549.                   case 5:
  550.                      an=15;
  551.                      break;
  552.                   case 6:
  553.                      an=18;
  554.                      break;
  555.                   case 7:
  556.                      an=21;
  557.                      break;
  558.                   case 8:
  559.                      an=24;
  560.                      break;
  561.                   case 9:
  562.                      an=30;
  563.                      break;
  564.                }
  565.                break;
  566.             case 5:
  567.                switch (ITEMNUM(Mcode)){
  568.                   case 0:
  569.                      col=1;
  570.                      break;
  571.                   case 1:
  572.                      col=2;
  573.                      break;
  574.                   case 2:
  575.                      col=3;
  576.                      break;
  577.                   case 3:
  578.                      col=4;
  579.                      break;
  580.                   case 4:
  581.                      col=5;
  582.                      break;
  583.                   case 5:
  584.                      col=6;
  585.                      break;
  586.                   case 6:
  587.                      col=7;
  588.                      break;
  589.                   case 7:
  590.                      col=8;
  591.                      break;
  592.                   case 8:
  593.                      col=9;
  594.                      break;
  595.                   case 9:
  596.                      col=10;
  597.                      break;
  598.                }
  599.                break;
  600.          }
  601.    } 
  602.   /* end of Class switch */      
  603.    }/* while */
  604. }
  605.  
  606. init_scr()
  607. {
  608.  
  609. SetMenuStrip(w,&BdMenu);
  610.  
  611. }   /* end of init_scr */
  612.  
  613. Cleanup()
  614. {
  615.    CloseWindow(w);
  616.    CloseScreen(screen);
  617. }
  618.  
  619. cyclecolors()
  620. {
  621.    int i,temp;
  622.  
  623.    temp=*(p_ct+5);
  624.    for (i=5;i<=30;i++)
  625.       *(p_ct+i)=*(p_ct+i+1);
  626.    *(p_ct+31)=temp;
  627.    LoadRGB4(vp,p_ct,CTSIZ);
  628.    for (i=0;i<=delay;i++)
  629.       ;
  630. }
  631.  
  632. int stopcheck()
  633.  
  634. {
  635.    struct IntuiMessage *BdMsg;      /* Intuition message structure */
  636.    ULONG Mclass;               /* Message class */
  637.    USHORT Mcode,ItemNum;
  638.  
  639. ex = 0;
  640. while (BdMsg = (struct IntuiMessage *)GetMsg(w->UserPort))
  641.    {
  642.    Mclass = BdMsg->Class;
  643.    Mcode = BdMsg->Code;
  644.    ReplyMsg(BdMsg);
  645.    switch (Mclass) {
  646.       case CLOSEWINDOW:
  647.          clear_colors();
  648.          Cleanup();
  649.          exit(TRUE);
  650.          break;
  651.  
  652.       case MENUPICK:
  653.          switch (MENUNUM(Mcode)){
  654.             case 0:
  655.                ItemNum = ITEMNUM(Mcode);
  656.                switch (ItemNum){
  657.                   case 0:
  658.                      newradii(w);
  659.                      break;
  660.                   case 1:
  661.                      break;
  662.                   case 2:
  663.                      ex = 1;
  664.                      break;
  665.                   case 3:
  666.                      if (cycle==0)
  667.                         cycle=1;
  668.                      else
  669.                         cycle=0;
  670.                      break;
  671.                   case 4:
  672.                      palette(w);
  673.                      break;
  674.                   case 5:
  675.                      sav=save(w);
  676.                      if (sav==1){
  677.                         color18=GetRGB4(p_Co,18);/* save current color 18 */
  678.                         color19=GetRGB4(p_Co,19);/* save current color 19 */
  679.                         SetRGB4(vp,18,15,0,0);   /* red */
  680.                         SetRGB4(vp,19,15,15,15); /* white */
  681.                         SetPointer(w,&PointImage,14,16,0,0);
  682.                         SavePicture();
  683.                         ClearPointer(w);
  684.                         *(p_ct+18)=(USHORT)color18;
  685.                         *(p_ct+19)=(USHORT)color19;
  686.                         LoadRGB4(vp,p_ct,CTSIZ);  /* restore color table */
  687.                      }
  688.                      break;
  689.                   case 6:
  690.                      fillscreen();
  691.                      break;
  692.                   case 7:
  693.                      clear_colors();
  694.                      Cleanup();
  695.                      exit(TRUE);
  696.                }
  697.                break;
  698.             case 1:
  699.                switch (ITEMNUM(Mcode)){
  700.                   case 0:
  701.                      cc=0;
  702.                      break;
  703.                   case 1:
  704.                      cc=.25;
  705.                      break;
  706.                   case 2:
  707.                      cc=.5;
  708.                      break;
  709.                   case 3:
  710.                      cc=.75;
  711.                      break;
  712.                   case 4:
  713.                      cc=1.0;
  714.                      break;
  715.                   case 5:
  716.                      cc=1.25;
  717.                      break;
  718.                   case 6:
  719.                      cc=1.5;
  720.                      break;
  721.                   case 7:
  722.                      cc=1.75;
  723.                      break;
  724.                   case 8:
  725.                      cc=2.0;
  726.                      break;
  727.                   case 9:
  728.                      cc=2.5;
  729.                      break;
  730.                }
  731.                break;
  732.             case 2:
  733.                switch (ITEMNUM(Mcode)){
  734.                   case 0:
  735.                      bf=0;
  736.                      break;
  737.                   case 1:
  738.                      bf=.1;
  739.                      break;
  740.                   case 2:
  741.                      bf=.2;
  742.                      break;
  743.                   case 3:
  744.                      bf=.3;
  745.                      break;
  746.                }
  747.                break;
  748.             case 3:
  749.                switch (ITEMNUM(Mcode)){
  750.                   case 0:
  751.                      cf=.1;
  752.                      break;
  753.                   case 1:
  754.                      cf=.2;
  755.                      break;
  756.                   case 2:
  757.                      cf=.3;
  758.                      break;
  759.                   case 3:
  760.                      cf=.4;
  761.                      break;
  762.                   case 4:
  763.                      cf=.5;
  764.                      break;
  765.                   case 5:
  766.                      cf=.6;
  767.                      break;
  768.                   case 6:
  769.                      cf=.7;
  770.                      break;
  771.                   case 7:
  772.                      cf=.8;
  773.                      break;
  774.                }
  775.                break;
  776.             case 4:
  777.                switch (ITEMNUM(Mcode)){
  778.                   case 0:
  779.                      an=0;
  780.                      break;
  781.                   case 1:
  782.                      an=3;
  783.                      break;
  784.                   case 2:
  785.                      an=6;
  786.                      break;
  787.                   case 3:
  788.                      an=9;
  789.                      break;
  790.                   case 4:
  791.                      an=12;
  792.                      break;
  793.                   case 5:
  794.                      an=15;
  795.                      break;
  796.                   case 6:
  797.                      an=18;
  798.                      break;
  799.                   case 7:
  800.                      an=21;
  801.                      break;
  802.                   case 8:
  803.                      an=24;
  804.                      break;
  805.                   case 9:
  806.                      an=30;
  807.                      break;
  808.                }
  809.                break;
  810.             case 5:
  811.                switch (ITEMNUM(Mcode)){
  812.                   case 0:
  813.                      col=1;
  814.                      break;
  815.                   case 1:
  816.                      col=2;
  817.                      break;
  818.                   case 2:
  819.                      col=3;
  820.                      break;
  821.                   case 3:
  822.                      col=4;
  823.                      break;
  824.                   case 4:
  825.                      col=5;
  826.                      break;
  827.                   case 5:
  828.                      col=6;
  829.                      break;
  830.                   case 6:
  831.                      col=7;
  832.                      break;
  833.                   case 7:
  834.                      col=8;
  835.                      break;
  836.                   case 8:
  837.                      col=9;
  838.                      break;
  839.                   case 9:
  840.                      col=10;
  841.                      break;
  842.                }
  843.                break;
  844.          }
  845.       } 
  846.    }/* while */
  847.    return(ex);
  848. }
  849.